import { Router } from 'express';
import { UserController } from '../controllers/userController';
import { authMiddleware } from '../middlewares/authMiddleware';
export default (): Router => {
  const router = Router();
  const userController = new UserController();

  // 公开路由：注册和登录
  router.post('/register', userController.register);
  router.post('/login', userController.login);
  router.get('/captcha', userController.getCaptcha);

  // // 受保护的路由：需要登录才能访问
  router.get('/profile', authMiddleware, userController.getProfile);
  router.put('/changePassInfo', authMiddleware, userController.changePassInfo);
  router.put('/adminChangePassInfo', authMiddleware, userController.adminChangePassInfo);
  // router.put('/change-password', authMiddleware, userController.changePassword);
  
  // // 管理员路由：获取所有用户（在实际应用中可能需要管理员权限验证）
  // router.get('/all', authMiddleware, userController.getAllUsers);

  return router;
};